package com.cty.mapper;

import com.cty.pojo.Employee;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface EmployeeMapper {

    List<Employee> queryByNameAndBySalary(@Param("name") String name, @Param("salary") Double salary);
    List<Employee> queryByNameAndBySalaryTrim(@Param("name") String name, @Param("salary") Double salary);

    int updateByIdAndByName(@Param("id") Integer id,@Param("name") String name,@Param("salary") Double salary);
    int updateByIdAndByNameTrim(@Param("id") Integer id,@Param("name") String name,@Param("salary") Double salary);

    //查询规则：如果名字不为空根据名字查询，否则根据薪水查询，都为空查询全部
    List<Employee> queryByNameAndByChoose(@Param("name") String name, @Param("salary") Double salary);



    //批量的话一定要加@Param()便于认证或者arg0等
    //批量查询
    Employee queryBatch(@Param("list") List<Integer> ids);

    //批量插入
    int insertBatch(@Param("list")List<Employee> employeeList);

    //批量删除
    int deleteBatch(@Param("list")List<Integer> ids);

    //批量更新
    int updateBatch(@Param("list")List<Employee> employeeList);

}
